package main

import (
	"fyne.io/fyne/v2"
	"fyne.io/fyne/v2/app"
	"fyne.io/fyne/v2/container"
	"fyne.io/fyne/v2/layout"
	"fyne.io/fyne/v2/widget"
)

var (
	label  *widget.Label
	button *widget.Button
	form   *fyne.Container
)

func main() {
	a := app.New()
	w := a.NewWindow("Hello GO")

	label = widget.NewLabel("Hello GO,Submit")

	button = widget.NewButton("Submit", nil)

	button.OnTapped = func() {
		labelT := widget.NewLabel("Hello GO,BackUP")

		buttonT := widget.NewButton("BackUP", nil)

		buttonT.OnTapped = func() {
			w.SetContent(form)
		}

		formT := container.New(layout.NewVBoxLayout(), labelT, buttonT)

		w.SetContent(formT)
	}

	form = container.New(layout.NewVBoxLayout(), label, button)

	w.SetContent(form)
	w.Resize(fyne.NewSize(1024, 768))
	w.CenterOnScreen()
	w.ShowAndRun()
}
